package com.check.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.check.dao.WorkRoleDao;
import com.check.pojo.MarkWorkRole;
import com.check.pojo.PageObject;
import com.check.pojo.WorkRole;

@Repository("workRoleDao")
public class WorkRoleDaoImpl  extends BaseSqlMapDao implements WorkRoleDao{

	
	public List<WorkRole> findAllWorkRole(Map map) {
		return getSqlMapClientTemplate().queryForList("WorkRole.findAllWorkRoleByPage",map);
	}

	public WorkRole findWorkRoleById(String w_id) throws Exception {
		
		return (WorkRole) findObject("WorkRole.findByWorkRoleId", w_id);
	}

	public void insertWorkRole(WorkRole workRole) throws Exception {
		
		insertObject("WorkRole.insertWorkRole", workRole);
	}

	public void updateWorkRole(WorkRole workRole) throws Exception {
		updateObject("WorkRole.updateWorkRole", workRole);
		
	}

	public void deleteWorkRole(String w_id) throws Exception {
		deleteObject("WorkRole.deleteWorkRole", w_id);
	}

	public int findWorkRoleCount() {
		return Integer.parseInt(findObject("WorkRole.findWorkRoleCount").toString());
	}

	public List<MarkWorkRole>  findW_Names() {
		return getSqlMapClientTemplate().queryForList("WorkRole.findWorkRoleNames");
	}

	public List<MarkWorkRole> findMarkWorkRoleById(String m_id){
		return getSqlMapClientTemplate().queryForList("WorkRole.findMarkWorkRoleById",m_id);
	}
	
	public List<WorkRole> findAllWorkRoleByType(String w_type){
		return getSqlMapClientTemplate().queryForList("WorkRole.findAllWorkRoleByType",w_type);
	}

	public void deleteWorkRoleCom(String w_id) {
		deleteObject("WorkRole.deleteWorkRoleCom", w_id);
	}
}
